package fybug.nulll.pdstream.WR.Parsing.Interface;
import com.sun.istack.internal.NotNull;

import fybug.nulll.pdfunctionlibrary.Annotations.MaybeStop;
import fybug.nulll.pdfunctionlibrary.Processing.Err.CallStop;
import fybug.nulll.pdfunctionlibrary.Processing.Err.Stop;
import fybug.nulll.pdfunctionlibrary.Processing.Interface.NeedInit;
import fybug.nulll.pdstream.WR.Parsing.Source.ParsingSource;
import fybug.nulll.pdstream.WR.Parsing.Source.Partition.ParsingPartition;
import fybug.nulll.pdstream.WR.Parsing.StringParsingS;
/**
 * <p>文本解析接口.</p>
 * <pre>
 * 通过该接口 <b>监听当前解析次数</b> 并对分割出的文本进行 <b>解析</b>
 * 由 {@link ParsingSource} 负责进行处理数据并 <b>裁剪出要解析的部分</b>
 *
 * 如果你想在运行中终止解析请抛出 {@link Stop}
 * </pre>
 *
 * @author fybug
 * @version 0.0.2
 * @see NeedInit
 * @see MaybeStop
 * @see Stop
 * @see CallStop
 * @see StringParsingS
 * @since JDK 1.8
 */
public
interface StringResolve extends NeedInit {
    @MaybeStop
    @Override
    default
    void init() {}

    @Override
    default
    void destroy() {}

    /**
     * <p>解析文本数据.</p>
     * <pre>
     * {@link ParsingSource} 通过 {@link ParsingPartition} 分割好数据后会调用该方法 <b>传入被分割好的文本</b>
     * </pre>
     */
    @MaybeStop
    @NotNull
    void resolve(@NotNull final String s) throws Stop;

    /**
     * <p>解析次数.</p>
     * <p>因为无法确认 <b>总体进度</b> 所以传入的是当前解析次数</p>
     *
     * @param l 当前解析数量
     */
    @MaybeStop
    void progress(final long l);
}
